home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / General / MM3MCp.sea Folder / Sample template file / mmModalDialog.c
Text File  |  1994-01-09  |  18KB  |  574 lines

  1. $$Loop ModalDialogs
  2. $$Message MM Modal Dialog, mm:mmD_$Worksheet.name$.cp
  3.  
  4. $$File mm:mmD_$Worksheet.name$.cp
  5. /*  mmD_$Worksheet.name$                                 Handle this dialog */
  6. /*  $CopyRight$ */
  7.  
  8. /*    File name:  mmD_$Worksheet.name$.c
  9.     Function:  Handle this modal dialog.
  10.  
  11.     This dialog is called when:
  12.  
  13.     History: $Date$ Original by $Author$
  14.  
  15. */
  16.  
  17. #include "mmCommon$Prototype.name$.h"    /* Common */
  18. #include "Common$Prototype.name$.h"        /* Common */
  19.  
  20. /* ======================================================= */
  21. /* ======================================================= */
  22.  
  23. /* Routine: Init */
  24. /* Purpose: Initialize the modal dialog, globals and call users routine */
  25.  
  26. void CmmD$Worksheet.name$::Init()
  27. {
  28.  
  29.  
  30. inherited::Init();
  31.  
  32. $$Loop Control.type = Button
  33. this->Enable_$Control.name$ = $Control.Active$;        /* Button */
  34. $$EndLoop
  35. $$Loop Control.type = HotRect
  36. $$if Control.HotSpot
  37. this->Enable_$Control.name$ = $Control.Active$;        /* HotSpot  */
  38. $$endif
  39. $$EndLoop
  40. $$Loop Control.type = Checkbox
  41. this->Enable_$Control.name$ = $Control.Active$;        /* Checkbox  */
  42. $$if Control.Selected
  43. this->Value_$Control.name$ = 1;
  44. $$endif
  45. $$if Control.Unselected
  46. this->Value_$Control.name$ = 0;
  47. $$endif
  48. $$EndLoop
  49. $$Loop Control.type = Radio
  50. this->Enable_$Control.name$ = $Control.Active$;        /* Radio */
  51. $$if Control.Selected
  52. this->Value_$Control.name$ = 1;
  53. $$endif
  54. $$if Control.Unselected
  55. this->Value_$Control.name$ = 0;
  56. $$endif
  57. $$EndLoop
  58. $$Loop Control.type = ScrollBar
  59. this->Enable_$Control.name$ = $Control.Active$;        /* ScrollBar */
  60. this->Value_$Control.name$ = $Control.ValueScroll$;
  61. $$EndLoop
  62. $$Loop Control.type = Icon
  63. this->Enable_$Control.name$ = $Control.Active$;        /* Icon button  */
  64. $$EndLoop
  65. $$Loop Control.type = Sicn
  66. this->Enable_$Control.name$ = $Control.Active$;        /* Sicn button  */
  67. $$EndLoop
  68. $$Loop Control.type = Picture
  69. $$if Control.NonGraphic
  70. this->Enable_$Control.name$ = $Control.Active$;        /* Picture button  */
  71. $$endif
  72. $$EndLoop
  73. $$Loop Control.type = UButton
  74. this->Enable_$Control.name$ = $Control.Active$;        /* Plugin button */
  75. $$EndLoop
  76. $$Loop Control.type = UToggle
  77. this->Enable_$Control.name$ = $Control.Active$;        /* Plugin toggle */
  78. $$if Control.Selected
  79. this->Value_$Control.name$ = 1;
  80. $$endif
  81. $$if Control.Unselected
  82. this->Value_$Control.name$ = 0;
  83. $$endif
  84. $$EndLoop
  85. $$Loop Control.type = UGauge
  86. this->Enable_$Control.name$ = $Control.Active$;        /* Plugin gauge */
  87. this->Value_$Control.name$ = $Control.ValueScroll$;
  88. $$EndLoop
  89. $$Loop Control.type = Popup
  90. this->Enable_$Control.name$ = $Control.Active$;        /* Popup menu */
  91. this->Value_$Control.name$ = $Control.SelectedID$;
  92. $$EndLoop
  93. $$Loop Control.type = Palette
  94. this->Enable_$Control.name$ = $Control.Active$;        /* Palette */
  95. this->Value_$Control.name$ = $Control.ValueScroll$;
  96. $$EndLoop
  97. $$Loop Control.type = List
  98. this->List_$Control.name$ = nil;                        /* List */
  99. SetRect(&this->ListRect_$Control.name$,$Control.LeftPosition$,$Control.TopPosition$,$Control.RightPosition$,$Control.BottomPosition$);                /* left,top,right,bottom */
  100. $$EndLoop
  101. $$Loop Control.type = EditText
  102. this->TE_$Control.name$ = nil;                        /* Edit Text */
  103. SetRect(&this->TERect_$Control.name$,$Control.LeftPosition$,$Control.TopPosition$,$Control.RightPosition$,$Control.BottomPosition$);                /* left,top,right,bottom */
  104. GetIndString(this->TEStr_$Control.name$,sResD_$Control.name$,1);/*  ...Edit text, default value  */
  105. $$EndLoop
  106.  
  107. }
  108.  
  109. /* ======================================================= */
  110.  
  111. void CmmD$Worksheet.name$::FilterMouseDown(DialogPtr theDialog,EventRecord *theEvent,
  112.     short *itemHit,Point MyPt)
  113. {
  114. Rect            tempRect;                        /* Temporary rectangle */
  115. short            DType;                            /* Type of dialog item */
  116. short            code;
  117. Handle            DItem;                            /* Handle to the dialog item */
  118. ControlHandle    CItem;                            /* Control handle */
  119.  
  120.  
  121. inherited::FilterMouseDown(theDialog,theEvent,itemHit,MyPt);
  122.  
  123. $$Loop Control.type = List
  124. if (PtInRect(MyPt,&this->ListRect_$Control.name$))
  125.     ClickInTheList(MyPt,theEvent->modifiers,this->List_$Control.name$,
  126.         $Control.TextSize$,$Control.TextFont$,$Control.TextStyle$,true);
  127.  
  128. $$EndLoop
  129. $$Loop Control.type = ScrollBar
  130. GetDItem (theDialog ,ResD_$Control.name$, &DType, &DItem, &tempRect);/* Get the item */
  131. if (PtInRect(MyPt,&tempRect))
  132.     {
  133.     CItem = (ControlHandle)DItem;            /* Make it a controlhandle */
  134.     code = TestControl(CItem,MyPt);            /* Get where in the Scrollbar we were pressed */
  135.     HandleWScrollBar(MyPt,code,$Control.StepScroll$,$Control.PageScroll$,CItem);/* Handle the scrollbar */
  136.     }
  137.  
  138. $$EndLoop
  139. $$Loop Control.type = UGauge
  140. GetDItem (theDialog ,ResD_$Control.name$, &DType, &DItem, &tempRect);/* Get the item */
  141. if (PtInRect(MyPt,&tempRect))
  142.     {
  143.     CItem = (ControlHandle)DItem;            /* Make it a controlhandle */
  144.     code = TestControl(CItem,MyPt);            /* Get where in the gauge we were pressed */
  145.     HandleWScrollBar(MyPt,code,$Control.StepScroll$,$Control.PageScroll$,CItem);/* Handle the scrollbar */
  146.     }
  147.  
  148. $$EndLoop
  149. }
  150.  
  151. /* ======================================================= */
  152.  
  153. /* Routine: Refresh */
  154. /* Purpose: Refresh the dialogs non-controls */
  155.  
  156. void CmmD$Worksheet.name$::Refresh()
  157. {
  158. Rect            rTempRect;                        /* Temp rectangle used for drawing */
  159. short            DType;                            /* Type of dialog item */
  160. Handle            DItem;                            /* Handle to the dialog item */
  161. ControlHandle    CItem;                            /* Control handle */
  162. $$if Option.Color
  163. RGBColor        Saved_ForeColor;                /* Save colors */
  164. RGBColor        Saved_BackColor;                /* Save colors */
  165. RGBColor        DrawingColor;                    /* Place to make colors */
  166. $$endif
  167.  
  168.  
  169. SetPort(this->theWindow);                        /* Point to our dialog window */
  170. rTempRect = tempRect;                            /* Save the current contents of  tempRect */
  171. $$if Option.Color
  172. if (Has.ColorQD)                                /* See if color QuickDraw is around */
  173.     {
  174.     GetForeColor(&Saved_ForeColor);                /* Save the fore color */
  175.     GetBackColor(&Saved_BackColor);                /* Save the back color */
  176.  
  177.     RGBForeColor(&Black_ForeColor);                /* Set the fore color to Black */
  178.     RGBBackColor(&White_BackColor);                /* Set the back color to White */
  179.     }
  180.  
  181. $$endif
  182. $$Loop Control.type = Button
  183. $$if Control.Default
  184. /* This is the default selection, when RETURN is pressed. */
  185. HiliteDefaultButton(this->theWindow,ResD_$Control.name$);
  186.  
  187. $$endif Control.Default
  188. $$EndLoop Control.type
  189. $$Loop Control.type = Line
  190. /* Draw a line, $Control.FullName$ */
  191. $$if Control.GrayLine
  192. PenPat(qd.gray);                                        /* Set the gray pen pattern */
  193. $$endif Control.GrayLine
  194. $$if Control.LineWidth ! 1
  195. PenSize($Control.LineWidth$,$Control.LineWidth$);
  196. $$endif Control.LineWidth
  197. MoveTo($Control.LeftPosition$,$Control.TopPosition$);        /* Horz,vert, Move to starting position */
  198. LineTo($Control.RightPosition$,$Control.BottomPosition$);    /* Horz,vert, Draw to the ending position */
  199. $$if Control.LineWidth ! 1
  200. PenSize(1,1);
  201. $$endif Control.LineWidth
  202. $$if Control.GrayLine
  203. PenPat(qd.black);                                        /*  Back to default pen pattern  */
  204. $$endif Control.GrayLine
  205.  
  206. $$EndLoop
  207. $$Loop Control.type = StaticText
  208. $$if Control.SpecialText
  209. /* Draw static text */
  210. $$if Option.Color
  211. $$if Control.TextColor ! Black
  212. if (Has.ColorQD)                                    /* See if color QuickDraw is around */
  213.     {
  214.     DrawingColor.red = 0x$Control.RedTextColor$;
  215.     DrawingColor.green = 0x$Control.GreenTextColor$;
  216.     DrawingColor.blue = 0x$Control.BlueTextColor$;
  217.     RGBForeColor(&DrawingColor);                    /* Set the fore color */
  218.     RGBBackColor(&Saved_BackColor);                    /* Set the back color */
  219.     }
  220. $$endif Control.TextColor
  221. $$endif Color
  222. $$if Control.MultipleLine
  223. SetRect(&tempRect,$Control.LeftPosition$,$Control.TopPosition$,$Control.RightPosition$,$Control.BottomPosition$);
  224. DrawStaticTextBox(sResD_$Control.name$,&tempRect,$Control.TextAlignment$,$Control.TextSize$,$Control.TextFont$,$Control.TextStyle$);
  225. $$endif Control.MultipleLine
  226. $$if Control.SingleLine
  227. DrawStaticLine(sResD_$Control.name$,$Control.LeftPosition$,$Control.TopPosition$,$Control.TextSize$,$Control.TextFont$,$Control.TextStyle$);
  228. $$endif Control.SingleLine
  229. $$if Option.Color
  230. $$if Control.TextColor ! Black
  231. if (Has.ColorQD)                                    /* See if color QuickDraw is around */
  232.     {
  233.     RGBForeColor(&Black_ForeColor);                    /* Set the fore color */
  234.     RGBBackColor(&White_BackColor);                    /* Set the back color */
  235.     }
  236. $$endif Control.TextColor
  237. $$endif Color
  238.  
  239. $$endif Control.SpecialText
  240. $$EndLoop
  241. $$Loop Control.type = List
  242. UpdateTheList(this->theWindow->visRgn,this->List_$Control.name$,
  243.     &this->ListRect_$Control.name$,$Control.TextSize$,$Control.TextFont$,$Control.TextStyle$,true);
  244.  
  245. $$EndLoop
  246. TextSize(12);
  247. TextFont(systemFont);                                /* Select the Font that we want */
  248. TextFace(0);                                        /* Select the style that we want */
  249.  
  250. $$if Option.Color
  251. if (Has.ColorQD)                                /* See if color QuickDraw is around */
  252.     {
  253.     RGBForeColor(&Saved_ForeColor);                /* Restore the fore color */
  254.     RGBBackColor(&Saved_BackColor);                /* Restore the back color */
  255.     }
  256. $$endif
  257.  
  258. }
  259.  
  260. /* ======================================================= */
  261.  
  262. /* Routine: BringUpDialog */
  263. /* Purpose: Modal dialog */
  264.  
  265. void CmmD$Worksheet.name$::BringUpDialog()
  266. {
  267. Rect        tempRect;                                /* Temporary rectangle */
  268. short        DType;                                    /* Type of dialog item */
  269. short        Index;                                    /* For looping */
  270. Handle        DItem;                                    /* Handle to the dialog item */
  271. ControlHandle    CItem;                                /* Control handle */
  272. ControlHandle    CTempItem;                            /* Control handle */
  273. Str255        sTemp;                                    /* Get text entered, temp holding */
  274. short        itemHit;                                /* Get selection */
  275. short        temp;                                    /* Get selection, temp holding */
  276. short        theSelection;                            /* For Palettes */
  277. long        theLong,LTemp2;                            /* For Hotspot setup */
  278. short        theRow;                                    /* This is used to define the row used in a list */
  279. GrafPtr        SavedPort;                                /* Previous grafport */
  280. Point        MyPt;
  281. DialogPtr    theDialog;
  282.  
  283.  
  284. gCurrentModalDialog = g$Worksheet.name$;
  285.  
  286. GetPort(&SavedPort);                                /* Get the previous grafport */
  287. HoldOffUserEvents = true;                            /* Hold off the user events */
  288.  
  289. this->theWindow = GetNewDialog(ResD_$Worksheet.name$,nil,(WindowPtr)-1);/* Bring in the dialog resource */
  290. theDialog = this->theWindow;
  291. SetPort(theDialog);            /* Prepare to add conditional text */
  292.  
  293. $$if Worksheet.Center
  294. tempRect = theDialog->portRect;            /* Get the windows position and size */
  295. $$if Worksheet.CenterHorz
  296. tempRect.left = ((qd.screenBits.bounds.right - qd.screenBits.bounds.left) - (tempRect.right - tempRect.left)) / 2;    /* Center Horz */
  297. $$endif Worksheet.CenterHorz
  298. $$if Worksheet.CenterVert
  299. tempRect.top = ((qd.screenBits.bounds.bottom - qd.screenBits.bounds.top) - (tempRect.bottom - tempRect.top)) / 3;    /* 1/3 vert */
  300.     if (tempRect.top < 40)                            /* Keep below the menu bar */
  301.     tempRect.top = 40;
  302. $$endif Worksheet.CenterVert
  303. MoveWindow(theDialog,tempRect.left,tempRect.top,true);
  304.  
  305. $$endif
  306. $$Loop Control.type = Button
  307. /* Button */
  308. SetupNormalControl(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,0);
  309.  
  310. $$EndLoop Button
  311. $$Loop Control.type = Checkbox
  312. /* Checkbox */
  313. SetupNormalControl(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  314.     this->Value_$Control.name$);
  315.  
  316. $$EndLoop Checkbox
  317. $$Loop Control.type = Radio
  318. /* Radio button */
  319. SetupNormalControl(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  320.     this->Value_$Control.name$);
  321.  
  322. $$EndLoop Radio
  323. $$Loop Control.type = List
  324. /* Make a List */
  325. Make_A_List(&this->List_$Control.name$,&this->ListRect_$Control.name$,
  326.     theDialog,sResD_$Control.name$,$Control.TextSize$,$Control.TextFont$,$Control.TextStyle$,true);
  327.  
  328. $$EndLoop
  329. $$Loop Control.type = HotRect
  330. /* Draw a Hotspot or Rectangle */
  331. SetupHotSpot(theDialog,ResD_$Control.name$,$Control.MakeHotSpot$,$Control.LineWidth$,
  332.     $Control.ShadowWidth$,sResD_$Control.name$,this->Enable_$Control.name$);
  333.  
  334. $$EndLoop
  335. $$Loop Control.type = EditText
  336. GetDItem(theDialog,ResD_$Control.name$,&DType,&DItem,&tempRect);/* Get the item handle */
  337. GetIndString(sTemp,sResD_$Control.name$,1);            /* ...Edit text, default value */
  338. SetIText(DItem,sTemp);                                /* Set the default text string */
  339. SelIText(theDialog,ResD_$Control.name$,0,300);
  340.  
  341. $$EndLoop
  342. $$Loop Control.type = Popup
  343. SetupPopupMenu(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  344.     mResD_$Control.name$,this->Value_$Control.name$);
  345.  
  346. $$EndLoop
  347. $$Loop Control.type = Picture
  348. $$if Control.NonGraphic
  349. /* Draw a picture */
  350. LTemp = ResD_N_$Control.name$;                        /* Picture ID and resize flag */
  351. $$if Control.ClipPicture
  352. LTemp = 0x00010000 | LTemp;
  353. $$endif Control.ClipPicture
  354. SetupTheItem(theDialog,ResD_$Control.name$,true,true,
  355.     this->Enable_$Control.name$,false,&tempRect,LTemp,0);/* Setup the Picture button */
  356.  
  357. $$endif Control.NonGraphic
  358. $$EndLoop
  359. $$Loop Control.type = Palette
  360. /* Draw a Palette */
  361. SetupPalette(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  362.     $Control.NumRows$,$Control.NumColumns$,ResD_N_$Control.name$,$Control.HMethod$);
  363.  
  364. $$EndLoop
  365. $$Loop Control.type = Icon
  366. $$if Control.NonGraphic
  367. /* Draw an Icon button */
  368. SetupIconSicn(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  369.     ResD_N_$Control.name$,ResD_H_$Control.name$);
  370.  
  371. $$endif Control.NonGraphic
  372. $$EndLoop
  373. $$Loop Control.type = Sicn
  374. /* Draw an Sicn */
  375. $$if Control.Graphic
  376. SetupIconSicn(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  377.     ResD_N_$Control.name$,ResD_N_$Control.name$);
  378. $$endif Control.Graphic
  379. $$if Control.NonGraphic
  380. SetupIconSicn(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  381.     ResD_N_$Control.name$,ResD_H_$Control.name$);
  382. $$endif Control.NonGraphic
  383.  
  384. $$EndLoop
  385. $$Loop Control.type = UButton
  386. SetupPlugin(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  387.     ResD_N_$Control.name$,ResD_H_$Control.name$,sResD_$Control.name$);
  388.  
  389. $$EndLoop
  390. $$Loop Control.type = UToggle
  391. SetupPlugin(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  392.     ResD_N_$Control.name$,ResD_H_$Control.name$,sResD_$Control.name$);
  393.  
  394. $$EndLoop
  395. $$Loop Control.type = UGauge
  396. SetupPlugin(theDialog,ResD_$Control.name$,this->Enable_$Control.name$,
  397.     ResD_N_$Control.name$,ResD_H_$Control.name$,sResD_$Control.name$);
  398. SetupMinMaxValue(theDialog,ResD_$Control.name$,$Control.MinScroll$,$Control.MaxScroll$,this->Value_$Control.name$);
  399.  
  400. $$EndLoop
  401. $$Loop Control.type = ScrollBar
  402. SetupTheItem(theDialog,ResD_$Control.name$,true,true,
  403.     this->Enable_$Control.name$,true,&tempRect,0,0);
  404. SetupMinMaxValue(theDialog,ResD_$Control.name$,$Control.MinScroll$,$Control.MaxScroll$,this->Value_$Control.name$);
  405.  
  406. $$EndLoop
  407.  
  408. this->ExitDialog = false;                            /* Do not exit dialog handle loop yet */
  409.  
  410. $$Link    Worksheet.Open
  411.  
  412. this->ExtraSetup();                                    /* Call user Dialog setup routine */
  413.  
  414. ShowWindow(theDialog);                                /* Open a dialog box */
  415. SelectWindow(theDialog);                            /* Lets see it */
  416.  
  417. do                                                    /* Start of dialog handle loop */
  418.     {
  419.     ModalDialog((ModalFilterProcPtr)&theModalDialogFilter,&itemHit);    /* Wait until an item is hit */
  420.  
  421.     this->DoItemHit(&itemHit,&this->ExitDialog);            /* Let user handle the item hit */
  422.  
  423.     if (itemHit == 32000)                            /* Check for update */
  424.         {
  425.         this->Refresh();                            /* Draw any Lists, lines, or rectangles */
  426.         EndUpdate(theDialog);                         /* End of the update */
  427.         }
  428.     else if (itemHit > 0)
  429.         {
  430.         GetDItem(theDialog,itemHit,&DType,&DItem,&tempRect);    /* Get item information */
  431.         CItem = (ControlHandle)DItem;                /* Get the control handle */
  432.         }
  433.  
  434.     $$Loop Control.type = Button
  435.     if (itemHit == ResD_$Control.name$)                /* Handle the Button being pressed */
  436.         {
  437.         $$Link    Control.Select
  438.         $$if Control.ExitDialog
  439.         this->ExitDialog = true;                            /* Close this dialog, exit */
  440.         $$endif Control.ExitDialog
  441.         }
  442.  
  443.     $$EndLoop Control.type
  444.     $$Loop Control.type = Checkbox
  445.     if (itemHit == ResD_$Control.name$)                /* Handle the checkbox being pressed */
  446.         {
  447.         temp = GetCtlValue(CItem);                    /* Get the current Checkbox value */
  448.         SetCtlValue(CItem, (temp + 1) & 1);            /* Toggle the value to the opposite */
  449.         this->Value_$Control.name$ = GetCtlValue(CItem);    /* Get the current Checkbox value */
  450.         $$if Control.HasLinks
  451.         if (this->Value_$Control.name$ == 0)
  452.             {
  453.             $$Link    Control.Deselect
  454.             }
  455.         else
  456.             {
  457.             $$Link    Control.Select
  458.             }
  459.         $$endif
  460.         }
  461.  
  462.     $$EndLoop Control.type
  463.     $$Loop Control.type = UButton
  464.     $$if Control.HasLinks
  465.     if (itemHit == ResD_$Control.name$)                /* Handle the Button being pressed */
  466.         {
  467.         $$Link    Control.Select
  468.         }
  469.  
  470.     $$endif
  471.     $$EndLoop Control.type
  472.     $$Loop Control.type = UToggle
  473.     if (itemHit == ResD_$Control.name$)                /* Handle the checkbox being pressed */
  474.         {
  475.         temp = GetCtlValue(CItem);                    /* Get the current Checkbox value */
  476.         SetCtlValue(CItem, (temp + 1) & 1);            /* Toggle the value to the opposite */
  477.         this->Value_$Control.name$ = GetCtlValue(CItem);    /* Get the current Checkbox value */
  478.         $$if Control.HasLinks
  479.         if (this->Value_$Control.name$ == 0)
  480.             {
  481.             $$Link    Control.Deselect
  482.             }
  483.         else
  484.             {
  485.             $$Link    Control.Select
  486.             }
  487.         $$endif
  488.         }
  489.  
  490.     $$EndLoop Control.type
  491.     $$Loop Control.type = Radio
  492.     if (itemHit == ResD_$Control.name$)            /* Handle the Radio being pressed */
  493.         {
  494.         SetCtlValue(CItem,1);
  495.         this->Value_$Control.name$ = 1;    /* Set the current Radio value */
  496.  
  497.         $$Loop RadioGroup
  498.         ClearTheRadio(theDialog,ResD_$Control.name$,&this->Value_$Control.name$);
  499.         $$EndLoop RadioGroup
  500.         $$Link    Control.Select
  501.         }
  502.  
  503.     $$EndLoop Control.type
  504.     $$Loop Control.type = HotRect
  505.     $$if Control.HotSpot
  506.     $$if Control.HasLinks
  507.     if (itemHit == ResD_$Control.name$)                /* Handle the HotSpot being pressed */
  508.         {
  509.         $$Link    Control.Select
  510.         }
  511.  
  512.     $$endif
  513.     $$endif Control.HotSpot
  514.     $$EndLoop
  515.     $$Loop Control.type = Popup
  516.     $$EndLoop
  517.     $$Loop Control.type = Picture
  518.     $$if Control.NonGraphic
  519.     $$if Control.HasLinks
  520.     if (itemHit == ResD_$Control.name$)                /* Handle the Picture being pressed */
  521.         {
  522.         $$Link    Control.Select
  523.         }
  524.  
  525.     $$endif
  526.     $$endif Control.NonGraphic
  527.     $$EndLoop
  528.     $$Loop Control.type = Palette
  529.     $$EndLoop
  530.     $$Loop Control.type = Icon
  531.     $$if Control.NonGraphic
  532.     $$if Control.HasLinks
  533.     if (itemHit == ResD_$Control.name$)                /* Handle the Icon being pressed */
  534.         {
  535.         $$Link    Control.Select
  536.         }
  537.  
  538.     $$endif
  539.     $$endif Control.NonGraphic
  540.     $$EndLoop
  541.     $$Loop Control.type = Sicn
  542.     $$if Control.NonGraphic
  543.     $$if Control.HasLinks
  544.     if (itemHit == ResD_$Control.name$)                /* Handle the Sicn being pressed */
  545.         {
  546.         $$Link    Control.Select
  547.         }
  548.  
  549.     $$endif
  550.     $$endif Control.NonGraphic
  551.     $$EndLoop
  552.     }
  553. while (!this->ExitDialog);                            /* Handle dialog items until exit selected */
  554.  
  555. /* Get results after dialog */
  556.  
  557. this->Exit();    /* Exiting the modal dialog */
  558.  
  559. $$Link    Worksheet.Close
  560.  
  561. SetPort(SavedPort);                                    /* Restore the previous grafport */
  562. DisposDialog(theDialog);        /* Flush the dialog out of memory */
  563.  
  564. gCurrentModalDialog = nil;
  565. HoldOffUserEvents = false;                            /* Let in the user events */
  566. }
  567.  
  568. /* ======================================================= */
  569. /* ======================================================= */
  570. $$CloseFile
  571. $$EndLoop
  572.  
  573.  
  574.